package com.example.test.dialogfactory;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.motion.widget.MotionLayout;

public class MainActivity22 extends AppCompatActivity {

    private View mTop;
    private TextView mImage;
    private MotionLayout mRoot;

    public static void start( Context context ) {

        Intent starter = new Intent( context, MainActivity22.class );
        context.startActivity( starter );
    }

    @Override
    protected void onCreate( Bundle savedInstanceState ) {

        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main22 );
        initView();
        initViewAction();
    }

    private void initView() {

        mRoot = (MotionLayout) findViewById( R.id.root );
        mTop = (View) findViewById( R.id.top );
        mImage = (TextView) findViewById( R.id.image );
    }

    private void initViewAction() {

        mImage.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                mRoot.transitionToState( R.id.start );
            }
        } );
    }
}